package reflection_generics_containers.reflection;

/**
 * @author LiuYan
 * @date 2023/7/16
 */
public class GetClassInstance {

    public static void main(String[] args) throws ClassNotFoundException {
        Person person = new Person();

        // 方法一:通过实例对象调用getClass()
        Class c1 = person.getClass();

        // 方法二:通过类型.class
        Class c2 = Person.class;

        // 方法三:Class.froName("类的全路径")
        Class c3 = Class.forName("reflection_generics_containers.reflection.Person");

        // class文件只有一份
        System.out.println(c1 == c2);
        System.out.println(c2 == c3);
    }
}
